﻿using System.Windows;
using churchtool.Plugin.SermonUpload.ViewModel;

namespace churchtool.Plugin.SermonUpload.View
{
    /// <summary>
    /// Interaction logic for ProgressDialog.xaml
    /// </summary>
    public partial class ProgressDialog : Window
    {
        private static ProgressDialog instance;

        #region Constructor

        private ProgressDialog()
        {
            InitializeComponent();
        }

        #endregion

        #region Event Handlers

        /// <summary>
        /// Cancels
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnWindowClosing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            var viewModel = (ProgressDialogViewModel)this.DataContext;
            viewModel.Cancel.Execute(null);
        }

        #endregion

        public static ProgressDialog Instance
        {
            get
            {
                if (instance == null)
                {
                    instance = new ProgressDialog();
                }
                return instance;
            }
        }
    }
}